export default ({ http }) => ({
  /**
   * 账号信息
   */

  // 验证码登录/账号登录
  createAccountLogin(query, response, error) {
    return http.post('/user/account/login', query, response, error, false)
  },

  // 注册
  createAccountReg(query, response, error) {
    return http.post('/user/account/register', query, response, error)
  },

  // 设置密码
  updateAccountPwdSet(query, response, error) {
    return http.put('/user/account/pwd/set', query, response, error)
  },

  // 用户-找回密码
  updateAccountPwdReset(query, response, error) {
    return http.put('/user/account/pwd/reset/sync', query, response, error)
  },

  // 用户 - 个人信息
  getAccountInfo(response, error) {
    return http.get('/user/account/info', {}, response, error)
  },

  // 用户 - 编辑信息
  editAccountInfo(query, response, error) {
    return http.put('/user/account/edit', query, response, error, false)
  },

  // 修改密码
  updateAccountPwdEdit(query, response, error) {
    return http.put('user/account/pwd/edit', query, response, error)
  },

  // 修改手机号
  createAccountPhone(query, response, error) {
    return http.post('/user/account/phone', query, response, error, false)
  },

  /**
   * 三方登录
   */
  // 配置
  getConfigThirdlogin(query, response, error) {
    return http.get('/config/thirdlogin', query, response, error, false)
  },

  // 用户
  getConfigThirdloginCheck(query, response, error) {
    return http.get('/config/thirdlogin/check', query, response, error, false)
  },

  // 绑定状态
  getConfigThirdloginBind(response, error) {
    return http.get('/user/thirdlogin/bind', {}, response, error)
  },

  // 绑定
  createConfigThirdloginBind(query, response, error) {
    return http.post('/user/thirdlogin/bind', query, response, error, false)
  },

  // 解绑
  deleteConfigThirdloginBind(query, response, error) {
    return http.delete('/user/thirdlogin/bind', query, response, error, false)
  },

  /**
   * 个人中心
   */

  // 基础信息
  getProfile(response) {
    return http.get('/user/profile', {}, response)
  },

  // 用户-签到
  createPunchIn(response, error) {
    return http.post('/user/punchIn', {}, response, error, false)
  },

  /**
   * 个人中心-财务中心
   */

  // 变更余额
  createBalanceOrder(query, response, error) {
    return http.post('/user/balance/order', query, response, error)
  },
  // 用户 - 余额 - 明细
  getBalanceFlow(query, response) {
    return http.get('/user/balance/flow', query, response)
  },
  // 账户余额
  getBalance(response) {
    return http.get('/user/balance', {}, response)
  },

  // 支付密码存在状态
  getBalancePwd(response) {
    return http.get('/user/balance/pwd', {}, response)
  },

  // 设置支付密码
  createBalancePwd(query, response, error) {
    return http.post('/user/balance/pwd', query, response, error, false)
  },

  // 修改支付密码
  updateBalancePwd(query, response, error) {
    return http.put('/user/balance/pwd', query, response, error, false)
  },

  // 推广课程
  getUserIncomeCourse(query, response) {
    return http.get('/user/income/course', query, response)
  },

  // 推广用户
  getUserIncomeUser(query, response) {
    return http.get('/user/income/user', query, response)
  },
  /**
   * 个人中心-用户订单
   */

  // 全部订单
  getOrder(type, query, response) {
    return http.get(`/user/order/${type}`, query, response)
  },

  // 取消订单
  getOrderCancel(query, response, error) {
    return http.put('/user/order/cancel', query, response, error)
  },

  // 删除订单
  deleteOrder(query, response, error) {
    return http.delete('/user/order', query, response, error, false)
  },

  // 订单详情
  getOrderInfo(id, response) {
    return http.get(`/user/order/info/${id}`, {}, response, {}, false)
  },

  /**
   * 个人中心-我的卡券
   */

  // 列表
  getCoupon(type, query, response) {
    return http.get(`/user/coupon/${type}`, query, response)
  },

  // 兑换
  createCouponExchange(query, response, error) {
    return http.post('/user/coupon/exchange', query, response, error)
  },

  /**
   * 个人中心-财务中心
   */

  // 收入-基础信息及充值
  getIncome(response) {
    return http.get('/user/income', {}, response)
  },

  // 收入-明细
  getIncomeFlow(query, response) {
    return http.get('/user/income/flow', query, response)
  },

  // 收入-提现-支付宝
  createIncomeEncashmentAlipay(query, response, error) {
    return http.post('/user/income/encashment/alipay', query, response, error)
  },

  // 收入-提现-微信
  createIncomeEncashmentWxpay(query, response, error) {
    return http.post('/user/income/encashment/wxpay', query, response, error)
  },

  // 收入-提现-微信
  createIncomeEncashmentWxpayOpenid(query, response, error) {
    return http.get('/user/income/encashment/wxpay/openid', query, response, error)
  },

  // 收入-提现-微信
  createIncomeEncashmentWxpayCheck(query, response, error) {
    return http.get('/user/income/encashment/wxpay/check', query, response, error, false)
  },

  // 收入-提现-余额
  createIncomeEncashmentBalance(query, response, error) {
    return http.post('/user/income/encashment/balance', query, response, error)
  },

  // 会员-界面
  getVip(response) {
    return http.get('/user/vip', {}, response)
  },

  // 会员-充值记录
  getVipFlow(query, response) {
    return http.get('user/vip/log', query, response)
  },

  // 会员-购买
  createVip(query, response) {
    return http.post('/user/vip', query, response)
  },

  // 积分-基础信息
  getCredit(query, response) {
    return http.get('/user/credit/base', query, response)
  },

  // 积分-充值
  createCredit(query, response, error) {
    return http.post('/user/credit', query, response, error, false)
  },

  // 积分-明细
  getCreditFlow(query, response) {
    return http.get('/user/credit/flow', query, response)
  },

  // 积分-签到
  createCreditSignIn(response, error) {
    return http.post('/user/credit/signIn', {}, response, error, false)
  },

  /**
   * 关注及粉丝
   */

  // 用户-关注列表
  getFollow(query, response) {
    return http.get('/user/follow', query, response, {}, false)
  },

  // 用户-关注他人
  createFollow(query, response, error) {
    return http.post('/user/follow', query, response, error, false)
  },

  // 用户-取消关注
  deleteFollow(query, response, error) {
    return http.delete('/user/follow', query, response, error, false)
  },

  // 用户-粉丝列表
  getFollowFollower(query, response) {
    return http.get('/user/follow/follower', query, response, {}, false)
  },

  // 用户-最近访客
  getUserVisitorRecent(query, response) {
    return http.get('/user/visitor/recent', query, response, {}, false)
  },
  // 用户-个人主页动态
  getUserHomeCircle(query, response) {
    return http.get('/user/home/circle', query, response, {}, false)
  },

  /**
   * 购物车
   */

  // 购物车页面
  getCart(response) {
    return http.get('/user/cart', {}, response)
  },

  // 添加到购物车
  createCart(query, response, error) {
    return http.post('/user/cart', query, response, error, false)
  },

  // 移除购物车商品
  deleteCart(query, response, error) {
    return http.delete('/user/cart ', query, response, error, false)
  },

  // 购物车数量
  getCartNum(response) {
    return http.get('/user/cart/num', {}, response, {}, false)
  },

  /**
   * 消息中心
   */
  // 课程提醒
  getSystemCourse(query, response, error) {
    return http.get('/user/system/course', query, response, error)
  },

  // 系统消息
  getSystemMessage(query, response, error) {
    return http.get('/user/system/message', query, response, error)
  },

  // 互动消息
  getNotifyComment(query, response, error) {
    return http.get('/user/notify/comment', query, response, error)
  },

  // 提问信息
  getNotifyQuestion(query, response, error) {
    return http.get('/user/notify/question', query, response, error)
  },

  // 设置已读
  createMessageRead(query, response, error) {
    return http.post('/user/message/read', query, response, error, false)
  },

  // 未读消息
  getUserNotifyUnread(response) {
    return http.get('/user/notify/unread', {}, response, {}, false)
  },

  /**
   * 用户-提问
   */
  // 提问
  createQuestion(query, response, error) {
    return http.post('/user/question', query, response, error, false)
  },

  // 提问回复
  createQuestionReply(query, response, error) {
    return http.post('/user/question/reply', query, response, error, false)
  },

  // 提问-对话框
  getQuestion(id, query, response, error) {
    return http.get(`/user/question/${id}`, query, response, error, false)
  },

  /**
   * 授课管理
   */
  // 列表
  getTeacherCourseList(type, query, response) {
    return http.get(`/user/teacher/course/${type}`, query, response)
  },

  // 添加课程
  createTeacherCourseAdd(query, response, error) {
    return http.post('/user/teacher/course/add', query, response, error, false)
  },

  // 编辑课程-页面
  getTeacherCourseEdit(id, response, error) {
    return http.get(`/user/teacher/course/${id}/edit`, {}, response, error)
  },

  // 编辑课程-提交
  updateTeacherCourseEdit(id, query, response, error) {
    return http.put(`/user/teacher/course/${id}/edit`, query, response, error, false)
  },

  // 关闭课程
  updateTeacherCourseClose(id, response, error) {
    return http.put(`/user/teacher/course/${id}/close`, {}, response, error, false)
  },

  // 打开课程
  updateTeacherCourseOpen(id, response, error) {
    return http.put(`/user/teacher/course/${id}/open`, {}, response, error, false)
  },

  // 删除课程
  deleteTeacherCourseDelete(id, response, error) {
    return http.delete(`/user/teacher/course/${id}/delete`, {}, response, error, false)
  },

  /**
   * 课时管理
   */
  // 课时树
  getTeacherCourseSectionTree(id, response, error) {
    return http.get(`/user/teacher/course/${id}/section/tree`, {}, response, error)
  },

  // 新建章节
  createTeacherCourseSectionMenu(id, pid, query, response, error) {
    return http.post(
      `/user/teacher/course/${id}/section/${pid}/menu`,
      query,
      response,
      error,
      false
    )
  },

  // 新建课时
  createTeacherCourseSectionData(id, pid, query, response, error) {
    return http.post(
      `/user/teacher/course/${id}/section/${pid}/data`,
      query,
      response,
      error,
      false
    )
  },

  // 编辑章节
  updateTeacherCourseSectionMenu(id, sid, query, response, error) {
    return http.put(`/user/teacher/course/${id}/section/${sid}/menu`, query, response, error, false)
  },

  // 编辑课时
  updateTeacherCourseSectionData(id, sid, query, response, error) {
    return http.put(`/user/teacher/course/${id}/section/${sid}/data`, query, response, error, false)
  },
  // 编辑课时 - 获取原数据
  getTeacherCourseSectionData(id, sid, response, error) {
    return http.get(`/user/teacher/course/${id}/section/${sid}/data`, {}, response, error)
  },

  // 删除课时
  deleteTeacherCourseSectionDelete(id, sid, response, error) {
    return http.delete(
      `/user/teacher/course/${id}/section/${sid}/delete`,
      {},
      response,
      error,
      false
    )
  },

  // 课程目录层级
  getTeacherCourseSectionLevel(id, response, error) {
    return http.get(`/user/teacher/course/${id}/section/level`, {}, response, error)
  },

  // 完结课时
  putUserTeacherCourseFinish(id, response) {
    return http.put(`/user/teacher/course/${id}/finish`, {}, response)
  },

  /*
   *收藏
   */

  // 提交
  createCollection(query, response, error) {
    return http.post('/user/collection', query, response, error, false)
  },

  // 列表
  getCollection(query, response, error) {
    return http.get('/user/collection', query, response, error)
  },

  // 取消收藏
  deleteCollection(query, response, error) {
    return http.delete('/user/collection', query, response, error, false)
  },

  // 批量取消
  deleteCollectionBatch(query, response, error) {
    return http.delete('/user/collection/batch', query, response, error, false)
  },

  /*
   * 意向课程
   */
  // 设置
  updateCourseFavorite(query, response, error) {
    return http.put('/user/course/favorite', query, response, error, false)
  },

  /*
   * 我的考试
   */
  // 记录列表
  getExamRecordList(query, response) {
    return http.get('/user/exam/record/list', query, response)
  },
  // 全部解析
  getUserExamRecord(query, response) {
    return http.get('/user/exam/record', query, response)
  },
  // 错题解析
  getUserExamRecordWrong(query, response) {
    return http.get('/user/exam/record/wrong', query, response)
  },
  // 获取试题
  getUserExamRecordWrongTopic(query, response) {
    return http.get('/user/exam/record/wrong/topic', query, response)
  },

  /**
   * 素材库
   */
  // 素材库列表
  getUserTeacherMaterialList(query, response, error, loading) {
    return http.get('/user/teacher/material/list', query, response, error, loading)
  },
  // 分组列表
  getUserTeacherMaterialCategoryList(query, response, error) {
    return http.get('/user/teacher/material/category/list', query, response, error, false)
  },
  // 上传提交
  postUserTeacherMaterialAdd(query, response, error) {
    return http.post('/user/teacher/material/add', query, response, error)
  },
  // 修改素材名称
  putUserTeacherMaterial(query, response, error) {
    return http.put('/user/teacher/material', query, response, error, false)
  },
  // 删除素材
  deleteUserTeacherMaterial(query, response, error) {
    return http.delete('/user/teacher/material', query, response, error, false)
  },
  // 移动素材分组
  putUserTeacherMaterialMove(query, response, error) {
    return http.put('/user/teacher/material/move', query, response, error, false)
  },
  // 创建分组
  postUserTeacherMaterialCategory(query, response, error) {
    return http.post('/user/teacher/material/category', query, response, error, false)
  },
  // 修改分组名称
  putUserTeacherMaterialCategory(query, response, error) {
    return http.put('/user/teacher/material/category', query, response, error, false)
  },
  // 删除分组
  deleteUserTeacherMaterialCategory(query, response, error) {
    return http.delete('/user/teacher/material/category', query, response, error, false)
  },
  // 请求素材的原始链接
  getAttachViewUrl(id, response) {
    return http.get(`/attach/${id}/view/url`, {}, response, {}, false)
  },

  /**
   * 人脸识别
   */
  // 创建人员
  postTencentFacePerson(query, response, error) {
    return http.post(`/user/tencent/face/person`, query, response, error, false)
  },

  // 解除绑定
  postTencentFacePersonDelete(query, response, error) {
    return http.post(`/user/tencent/face/person/delete`, query, response, error, false)
  },

  // 验证人脸
  postTencentFacePersonVerify(query, response, error) {
    return http.post(`/user/tencent/face/person/verify`, query, response, error, false)
  },

  // 直播课表日数据
  getCourseScheduleDaily(query, response, error) {
    return http.get(`/user/course/schedule/daily`, query, response, error)
  },

  // 直播课表
  getCourseSchedulePeriod(query, response, error) {
    return http.get(`/user/course/schedule/period`, query, response, error)
  },

  // 个人主页动态
  getUserHomeInfo(query, response, error) {
    return http.get(`/user/home/base`, query, response, error)
  },

  // 个人主页课程
  getUserHomeCourse(query, response, error) {
    return http.get(`/user/home/course`, query, response, error, false)
  },
  // 用户活动券
  getAccountTicket(response, error) {
    return http.get(`/user/ticket`, {}, response, error, false)
  }
})
